<template>
  <section>
    <Card style="min-height:320px">
      <p slot="title">红娘服务弹窗条款配置</p>
      <Button type="success" slot="extra" @click="saveServiceTerms">
        <Icon type="ios-loop-strong"></Icon>
        保存
      </Button>
      <editor :content="content" :key="key" ref="ckeditor"/>
    </Card>
  </section>
</template>
<script>
import editor from '@/components/editor';
export default {
  data() {
    return {
      id: "",
      content: "",
      key: Date.now()
    }
  },
  methods: {
    saveServiceTerms() {
      this.content = this.$refs['ckeditor'].editorData;
      this.jsonrpc.blind.admin.update({
        id: this.id,
        modal_content: this.content
      }).then(res=> {
        this.$Message.success("保存成功")
      })
    }
  },
  mounted() {
    this.jsonrpc.blind.admin.getRedContent().then((res) => {
      this.content = res.modal_content;
      this.id = res.id;
      this.key = Date.now()
    })
  },
  components: {
    editor
  }
}

</script>
<style>
  .ck-content { 
    height: 320px;
  }
</style>